package com.singleton;

/**
 * 饿汉式：单例
 * 被外部类使用时才创建实例
 */
public class HungryStaticSingleton {


    private static final HungryStaticSingleton hungryStaticSingleton;

    static {
        hungryStaticSingleton = new HungryStaticSingleton();
    }

    public HungryStaticSingleton() {
    }

    public static HungryStaticSingleton getInstance() {
        return hungryStaticSingleton;
    }
}
